package com.gbits.app.finance.convert;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.util.StringUtils;

public class MultiBankCreditSubjectConvert extends BankCreditSubjectConvert {

	@Override
	public String doConvert(Map<String, Object> map) {
		List<Map<String, Object>> subjects = super.getSubjectList(map);
		List<Map<String, Object>> list = super.getPayList(map);
		Map<String, Object> data = new HashMap<String, Object>(map);
		StringBuffer sb = new StringBuffer();
		if (null != list) {
			for (int i=0; i<list.size(); i++) {
				data.putAll(subjects.get(0));
				data.putAll(list.get(i));
				String value = super.doConvert(data);
				if (i > 0) {
					sb.append("\r\n");
				}
				if (!StringUtils.isEmpty(value)) {
					sb.append(value);
				}
			}
			return sb.toString();
		}
		return null;
	}

}
